package part4;

import java.util.Random;

/**
 * @author wcj
 * @Date 2021/5/12 15:00
 * @Version 1.0
 */
public class Part45 {

    /**
     * foreach
     */
    public static void testForeach1() {
        Random random = new Random(47);
        float[] arr = new float[10];
        for (int i = 0; i < 10; i++) {
            arr[i] = random.nextFloat();
        }
        for (float v : arr) {
            System.out.println("foreach遍历获取数组元素:" + v);
        }
    }

    /**
     * Character包装器类包装char类型，并且调用toCharArray()转化为数组
     */
    public static void testCharacter() {
        for (char c : "chengjunwu love shanshan".toCharArray()) {
            System.out.println("Character包装器类:" + c);
        }
    }

    public static void main(String[] args) {
        testForeach1();
        testCharacter();
    }
}
